﻿using System;

namespace diantou.dataModel
{
    /// <summary>
    /// 通知
    /// </summary>
    public abstract class noticeBase
    {
        /// <summary>
        /// 通知标识
        /// </summary>
        public int Id;
        /// <summary>
        /// 接收用户标识
        /// </summary>
        [fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        public int ReceiveId;
        /// <summary>
        /// 发送时间
        /// </summary>
        public DateTime SendTime = fastCSharp.date.NowSecond;
        /// <summary>
        /// 通知状态
        /// </summary>
        [fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        public bool IsRead;
    }
    /// <summary>
    /// 通知
    /// </summary>
    [fastCSharp.emit.jsonSerialize(IsAllMember = true)]
    [fastCSharp.emit.dataSerialize(IsReferenceMember = false, IsMemberMap = false)]
    [fastCSharp.code.cSharp.webView.clientType(Name = "diantou.notice")]
    [fastCSharp.code.cSharp.sqlModel]
    public partial class notice : noticeBase
    {
        /// <summary>
        /// 用户标识
        /// </summary>
        public int UserId;
        /// <summary>
        /// 关联话题标识
        /// </summary>
        public int TopicId;
        /// <summary>
        /// 推荐话题关键字
        /// </summary>
        public struct recommendTopicKey : IEquatable<recommendTopicKey>
        {
            /// <summary>
            /// 用户标识
            /// </summary>
            public int UserId;
            /// <summary>
            /// 话题标识
            /// </summary>
            public int TopicId;
            /// <summary>
            /// 
            /// </summary>
            /// <param name="value"></param>
            /// <returns></returns>
            public bool Equals(recommendTopicKey value)
            {
                return ((UserId ^ value.UserId) | (TopicId ^ value.TopicId)) == 0;
            }
            /// <summary>
            /// 
            /// </summary>
            /// <returns></returns>
            public override int GetHashCode()
            {
                return UserId ^ TopicId;
            }
            /// <summary>
            /// 
            /// </summary>
            /// <param name="obj"></param>
            /// <returns></returns>
            public override bool Equals(object obj)
            {
                return Equals((recommendTopicKey)obj);
            }
        }
        /// <summary>
        /// 推荐话题关键字
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true)]
        public recommendTopicKey RecommendTopicKey
        {
            get { return new recommendTopicKey { UserId = UserId, TopicId = TopicId }; }
        }
        /// <summary>
        /// 关联问题标识
        /// </summary>
        public int QuestionId;
        /// <summary>
        /// 推荐问题关键字
        /// </summary>
        public struct recommendQuestionKey : IEquatable<recommendQuestionKey>
        {
            /// <summary>
            /// 用户标识
            /// </summary>
            public int UserId;
            /// <summary>
            /// 问题标识
            /// </summary>
            public int QuestionId;
            /// <summary>
            /// 
            /// </summary>
            /// <param name="value"></param>
            /// <returns></returns>
            public bool Equals(recommendQuestionKey value)
            {
                return ((UserId ^ value.UserId) | (QuestionId ^ value.QuestionId)) == 0;
            }
            /// <summary>
            /// 
            /// </summary>
            /// <returns></returns>
            public override int GetHashCode()
            {
                return UserId ^ QuestionId;
            }
            /// <summary>
            /// 
            /// </summary>
            /// <param name="obj"></param>
            /// <returns></returns>
            public override bool Equals(object obj)
            {
                return Equals((recommendQuestionKey)obj);
            }
        }
        /// <summary>
        /// 推荐问题关键字
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true)]
        public recommendQuestionKey RecommendQuestionKey
        {
            get { return new recommendQuestionKey { UserId = UserId, QuestionId = QuestionId }; }
        }
        /// <summary>
        /// 关联收藏夹标识
        /// </summary>
        public int FavoriteId;
        /// <summary>
        /// 推荐收藏夹关键字
        /// </summary>
        public struct recommendFavoriteKey : IEquatable<recommendFavoriteKey>
        {
            /// <summary>
            /// 用户标识
            /// </summary>
            public int UserId;
            /// <summary>
            /// 收藏夹标识
            /// </summary>
            public int FavoriteId;
            /// <summary>
            /// 
            /// </summary>
            /// <param name="value"></param>
            /// <returns></returns>
            public bool Equals(recommendFavoriteKey value)
            {
                return ((UserId ^ value.UserId) | (FavoriteId ^ value.FavoriteId)) == 0;
            }
            /// <summary>
            /// 
            /// </summary>
            /// <returns></returns>
            public override int GetHashCode()
            {
                return UserId ^ FavoriteId;
            }
            /// <summary>
            /// 
            /// </summary>
            /// <param name="obj"></param>
            /// <returns></returns>
            public override bool Equals(object obj)
            {
                return Equals((recommendFavoriteKey)obj);
            }
        }
        /// <summary>
        /// 推荐收藏夹关键字
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true)]
        public recommendFavoriteKey RecommendFavoriteKey
        {
            get { return new recommendFavoriteKey { UserId = UserId, FavoriteId = FavoriteId }; }
        }
        /// <summary>
        /// 关联回答标识
        /// </summary>
        public int AnswerId;
        /// <summary>
        /// 关联评论标识
        /// </summary>
        public int CommentId;
        /// <summary>
        /// 关联勋章标识
        /// </summary>
        public int MedalId;
        /// <summary>
        /// OJ测试标识
        /// </summary>
        public int JudgeId;
        /// <summary>
        /// 推荐用户标识
        /// </summary>
        [fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        public int LinkUserId;
        /// <summary>
        /// 推荐用户关键字
        /// </summary>
        public struct recommendUserKey : IEquatable<recommendUserKey>
        {
            /// <summary>
            /// 用户标识
            /// </summary>
            public int UserId;
            /// <summary>
            /// 推荐用户标识
            /// </summary>
            public int LinkUserId;
            /// <summary>
            /// 
            /// </summary>
            /// <param name="value"></param>
            /// <returns></returns>
            public bool Equals(recommendUserKey value)
            {
                return ((UserId ^ value.UserId) | (LinkUserId ^ value.LinkUserId)) == 0;
            }
            /// <summary>
            /// 
            /// </summary>
            /// <returns></returns>
            public override int GetHashCode()
            {
                return UserId ^ LinkUserId;
            }
            /// <summary>
            /// 
            /// </summary>
            /// <param name="obj"></param>
            /// <returns></returns>
            public override bool Equals(object obj)
            {
                return Equals((recommendUserKey)obj);
            }
        }
        /// <summary>
        /// 推荐用户关键字
        /// </summary>
        [fastCSharp.emit.dataMember(IsIgnoreCurrent = true)]
        public recommendUserKey RecommendUserKey
        {
            get { return new recommendUserKey { UserId = UserId, LinkUserId = LinkUserId }; }
        }
        ///// <summary>
        ///// 重定向问题标识
        ///// </summary>
        //public int linkQuestionId;
        /// <summary>
        /// 提到话题标识
        /// </summary>
        [fastCSharp.emit.dataSerialize.member(IsIgnoreCurrent = true)]
        public int LinkTopicId;
        /// <summary>
        /// OJ问题标识
        /// </summary>
        public int ProblemId;
        /// <summary>
        /// 比赛问题标识
        /// </summary>
        public int ContestId;
        /// <summary>
        /// 教程标识
        /// </summary>
        public int TutorialId;
        /// <summary>
        /// 升级等级/点头盾数量
        /// </summary>
        public int UpGrade;
        /// <summary>
        /// 通知类型
        /// </summary>
        public class noticeInfo : Attribute
        {
            /// <summary>
            /// 值类型
            /// </summary>
            public isValue IsValue;
        }
        /// <summary>
        /// 通知类型
        /// </summary>
        public enum type : byte
        {
            /// <summary>
            /// 自定义通知
            /// </summary>
            [noticeInfo]
            Sys = 0,
            /// <summary>
            /// 用户赞同你的回答
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Answer | isValue.Question)]
            UserAgreeAnswer = 1,
            /// <summary>
            /// 用户感谢你的回答
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Answer | isValue.Question)]
            UserThankAnswer = 2,
            /// <summary>
            /// 用户关注你
            /// </summary>
            [noticeInfo(IsValue = isValue.User)]
            UserFocus = 3,
            /// <summary>
            /// XX用户回答了问题
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Answer | isValue.Question)]
            UserAnswerQuestion = 4,
            /// <summary>
            /// XX用户评论了回答
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Answer | isValue.Question | isValue.AnswerComment)]
            UserCommentAnswer = 5,
            /// <summary>
            /// 用户收藏了你的回答
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Answer | isValue.Question | isValue.Favorite)]
            UserFavoriteAnswer = 6,
            /// <summary>
            /// 用户关注了你的收藏
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Favorite)]
            UserFocusFavorite = 7,
            /// <summary>
            /// 用户修改了问题的标题
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Question)]
            UserReworkQuestionTitle = 8,
            /// <summary>
            /// 用户修改了问题的描述
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Question)]
            UserReworkQuestionDescription = 9,
            /// <summary>
            /// 用户修改了问题的重定向
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Question)]
            UserReworkQuestionLink = 10,
            /// <summary>
            /// 用户修改了话题的名称
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Question)]
            UserReworkTopicName = 11,
            /// <summary>
            /// 用户修改了话题的描述
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Topic)]
            UserReworkTopicDescription = 12,
            /// <summary>
            /// 用户修改了话题的图片
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Topic)]
            UserReworkTopicImage = 13,
            /// <summary>
            /// 用户邀请你回答问题
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Question)]
            UserInviteAnswerQuestion = 14,
            /// <summary>
            /// 用户邀请回答的用户回答了问题
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Answer | isValue.Question)]
            UserInviteAnswered = 15,
            /// <summary>
            /// 用户升级
            /// </summary>
            [noticeInfo]
            UserUpGrade = 16,
            /// <summary>
            /// 你邀请的用户升级了
            /// </summary>
            [noticeInfo(IsValue = isValue.User)]
            InviteUserUpGrade = 17,

            /// <summary>
            /// 问题的描述中提到用户
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Question)]
            QuestionRemarkMentionUser = 18,
            /// <summary>
            /// 答案中提到用户
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Answer | isValue.Question)]
            AnswerMentionUser = 19,
            /// <summary>
            /// 问题评论中提到用户
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Question | isValue.QuestionComment)]
            QuestionCommentMentionUser = 20,
            /// <summary>
            /// 答案的评论中提到用户
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Answer | isValue.Question | isValue.AnswerComment)]
            AnswerCommentMentionUser = 21,
            /// <summary>
            /// 收藏夹的评论中提到用户
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Favorite | isValue.FavoriteComment)]
            FavoriteCommentMentionUser = 22,
            /// <summary>
            /// 话题的描述中提到用户
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Topic)]
            TopicRemarkMentionUser = 23,

            /// <summary>
            /// 通过教程学习
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Tutorial)]
            PassTutorial = 24,
            /// <summary>
            /// 用户增加了点头盾
            /// </summary>
            [noticeInfo(IsValue = isValue.User)]
            NodPoint = 25,
            /// <summary>
            /// 用户的题目被选到比赛
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Contest | isValue.Problem)]
            ContestProblem = 26,
            /// <summary>
            /// 答案的评论中提到话题
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Answer | isValue.Question | isValue.AnswerComment | isValue.Topic)]
            _AnswerCommentMentionTopic = 27,
            /// <summary>
            /// 收藏夹的评论中提到话题
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Favorite | isValue.FavoriteComment | isValue.Topic)]
            _FavoriteCommentMentionTopic = 28,
            /// <summary>
            /// 话题的描述中提到话题
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Topic | isValue.LinkTopic)]
            _TopicRemarkMentionTopic = 29,

            /// <summary>
            /// 用户向你推荐问题
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Question)]
            _UserRecommendQuestion = 30,
            /// <summary>
            /// 用户向你推荐话题
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Topic)]
            _UserRecommendTopic = 31,
            /// <summary>
            /// 用户向你推荐用户
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.LinkUser)]
            _UserRecommendUser = 32,
            /// <summary>
            /// 用户向你推荐收藏夹
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Favorite)]
            _UserRecommendFavorite = 33,

            /// <summary>
            /// 用户获得勋章
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Medal)]
            GetMedal = 34,

            /// <summary>
            /// 收藏添加了新的评论
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Favorite)]
            FavoriteAppendComment = 35,
            /// <summary>
            /// 问题添加了新的评论
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Question)]
            QuestionAppendComment = 36,
            /// <summary>
            /// 回答添加了新的评论
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Answer | isValue.Question)]
            AnswerAppendComment = 37,

            /// <summary>
            /// 用户AC了题目获得点头盾
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Problem)]
            AcceptedProblem = 38,
            /// <summary>
            /// 用户赞了代码
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Problem | isValue.Judge)]
            UserAgreeJudge = 39,
            /// <summary>
            /// 用户赞同你的回答评论
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.AnswerComment | isValue.Answer | isValue.Question)]
            UserAgreeAnswerComment = 40,
            /// <summary>
            /// 用户赞同你的问题评论
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.QuestionComment | isValue.Question)]
            UserAgreeQuestionComment = 41,
            /// <summary>
            /// 用户赞同你的收藏夹评论
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.FavoriteComment | isValue.Favorite)]
            UserAgreeFavoriteComment = 42,
            /// <summary>
            /// 用户赞同你的提交代码评论
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.JudgeComment | isValue.Judge | isValue.Problem)]
            UserAgreeJudgeComment = 43,
            /// <summary>
            /// 用户评论你的提交代码
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Judge | isValue.Problem)]
            UserCommentJudge = 44,
            /// <summary>
            /// 提交代码添加了新的评论
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.JudgeComment | isValue.Judge | isValue.Problem)]
            JudgeAppendComment = 45,
            /// <summary>
            /// 提交代码的评论中提到用户
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Judge | isValue.Problem | isValue.JudgeComment)]
            JudgeCommentMentionUser = 46,
            /// <summary>
            /// ReJudge取消AC问题状态
            /// </summary>
            [noticeInfo(IsValue = isValue.Creator | isValue.Problem)]
            ReJudgeCancelAccepted = 47,
            /// <summary>
            /// 用户被指定为OJ问题验题人
            /// </summary>
            [noticeInfo(IsValue = isValue.User | isValue.Problem)]
            ProblemTestUser = 48,
        }
        /// <summary>
        /// 通知类型
        /// </summary>
        [fastCSharp.emit.dataMember(DataType = typeof(byte))]
        public type Type;
        /// <summary>
        /// 内容
        /// </summary>
        [fastCSharp.emit.dataMember(MaxStringLength = 512)]
        public string Content = String.Empty;
    }
}
